package data

import (
	"go-graduation/service/internal/data/PO"
)

type comment struct {
}

func NewArticleComment() *comment {
	return &comment{}
}

func (a *comment) GetListByPage(pageStart int, limit int) ([]PO.ArticleComment, error) {
	var rows []PO.ArticleComment
	err := NewDBClient().Table(PO.ArticleCommentTableName).Select("*").Offset(pageStart).Limit(limit).Find(&rows).Error
	return rows, err
}

func (a *comment) GetListByIds(ids []int) ([]PO.ArticleComment, error) {
	var rows []PO.ArticleComment
	err := NewDBClient().Table(PO.ArticleCommentTableName).Where("id IN (?)", ids).Find(&rows).Error
	return rows, err
}
